package com.gitee.sys.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.gitee.sys.pojo.LoginResult;
import com.gitee.sys.pojo.LoginUser;
import com.gitee.sys.service.ISysUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/sys/openResource/login")
@Api("用户登陆的api")
public class LoginController {

    @Reference
    private ISysUserService userService;

    @PostMapping
    @ApiOperation(value = "系统登陆", notes = "系统登陆", httpMethod = "POST")
    public ResponseEntity<LoginResult> login(@RequestBody LoginUser loginUser) {

        return ResponseEntity.ok(userService.login(loginUser));
    }

}
